Skip to content

UI for API Key Pair Management#13225

Open
bernardodemarco wants to merge 1 commit into
apache:mainfrom
scclouds:api-keypair-ui
Open

UI for API Key Pair Management#13225
bernardodemarco wants to merge 1 commit into
apache:mainfrom
scclouds:api-keypair-ui

Conversation

@bernardodemarco
Copy link
Copy Markdown
Member

Description

PR #9504 restructured and extended the implementation of API key pairs to improve flexibility and security. It is now possible to create multiple key pairs per user, define a specific permission scope for each key pair and specify a validation period during which they remain active.

This PR exposes these new features in the ACS graphical interface. Among the new functionalities, users can now list all key pairs associated with a user, view their details and permissions, and register new key pairs with validity periods and permission sets.

Additionally, some minor fixes and enhancements were introduced to the API key pair backend workflows, including:

  • Default roles Domain Admin, Resource Admin and User were granted access to the listUserKeyRules API;
  • The type of the description column of the cloud.api_keypair table was changed from VARCHAR(100) to VARCHAR(1024); and,
  • The type of the description column of the cloud.api_keypair_permissions table is VARCHAR(255). However, the registerUserKeys API currently do not validate the size of the corresponding API parameter. This validation has been introduced.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Screenshots (if appropriate):

2026-05-22.16-06-12.mp4

How Has This Been Tested?

The new UI sections were manually tested and their behavior was verified accordingly.

To test this patch, the backend must include PR #9504.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.09%. Comparing base (68221cf) to head (33e91bd).
⚠️ Report is 23 commits behind head on main.

Files with missing lines Patch % Lines
...ck/api/command/admin/user/RegisterUserKeysCmd.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #13225      +/-   ##
============================================
+ Coverage     18.08%   18.09%   +0.01%     
- Complexity    16718    16749      +31     
============================================
  Files          6037     6041       +4     
  Lines        542609   543106     +497     
  Branches      66432    66509      +77     
============================================
+ Hits          98136    98293     +157     
- Misses       433446   433764     +318     
- Partials      11027    11049      +22     
Flag Coverage Δ
uitests 3.50% <ø> (-0.02%) ⬇️
unittests 19.26% <33.33%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@winterhazel
Copy link
Copy Markdown
Member

@blueorangutan ui

@blueorangutan
Copy link
Copy Markdown

@winterhazel a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

UI build: ✔️
Live QA URL: https://qa.cloudstack.cloud/simulator/pr/13225 (QA-JID-940)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a CloudStack UI surface for the “multiple API key pairs per user” backend introduced in PR #9504, including listing key pairs, viewing key pair details/rules, and registering new key pairs with optional validity windows and rule-based permissions. It also includes a few backend/schema adjustments (description length increase, role permissions update, and parameter validation).

Changes:

  • Added a new User tab and Keypair (API key pair) resource view to list and navigate API key pairs, including rule display.
  • Added UI components to register API key pairs and to view/edit a key pair’s permission rules.
  • Updated schema/entity/API command metadata related to API key pair descriptions and rule-description validation.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
ui/src/views/iam/GenerateApiKeyPair.vue Modal/form to register an API key pair (name/description/dates/rules).
ui/src/views/iam/ApiKeyPairPermissionTable.vue UI for building/viewing rule-permissions; supports drag ordering and read-only table view.
ui/src/views/AutogenView.vue Adjusts param mapping for listUserKeys and resource selection behavior.
ui/src/config/section/user.js Adds apikeypairs tab to the User view.
ui/src/config/section/keypair.js Introduces a hidden “keypair” section for viewing API key pair details and rules.
ui/src/config/router.js Registers the new keypair section routes.
ui/src/components/view/ListView.vue Treats startdate/enddate as date fields for rendering.
ui/src/components/view/InfoCard.vue Displays API/secret key fields for keypair resources; adjusts status/apikeyaccess display logic.
ui/src/components/view/DetailsTab.vue Adds startdate/enddate date rendering and guards for empty values.
ui/src/components/view/ApiKeyPairsTab.vue New User tab listing key pairs with bulk delete and link to keypair detail view.
ui/public/locales/pt_BR.json Adds new UI strings (includes a typo).
ui/public/locales/en.json Adds new UI strings for API key pair management.
engine/schema/src/main/resources/META-INF/db/schema-42210to42300.sql Expands api_keypair.description size and grants role permissions for key APIs.
engine/schema/src/main/java/org/apache/cloudstack/acl/ApiKeyPairVO.java Aligns entity field length with DB schema change.
api/src/main/java/org/apache/cloudstack/api/command/admin/user/RegisterUserKeysCmd.java Adds parameter length metadata and introduces rule-description length validation (currently buggy).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

id: this.resource.id,
description: values.description ? values.description : null,
startdate: values.startDate ? parseDayJsObject({ value: values.startDate }) : null,
endDate: values.endDate ? parseDayJsObject({ value: values.endDate }) : null
return params
},
handleSubmit (e) {
e.preventDefault()
</div>
<div class="rules-table__col rules-table__col--permission">
<permission-editable
:defaultValue="newRulePermission"
}
this.deleteKeypairs(this.selectedItems)
},
deleteKeypairs (keypairs) {
"label.secondarystoragelimit": "Limites do armazenamento secund\u00e1rio (GiB)",
"label.secretkey": "Chave secreta",
"label.secret.key": "Chave secreta",
"label.apikeyaccess": "Accesso a pares de chaves de API",
Comment on lines +157 to +158
GenerateApiKeyPair,
store
:columns="columns"
:dataSource="keypairs"
:rowKey="item => item.id"
:key="item => item.id"
Comment on lines +289 to +313
deleteKeypairs (keypairs) {
this.fetchLoading = true
keypairs.forEach(async keypair => {
try {
const jobId = await this.deleteKeyPair({
keypairid: keypair.id
})
await this.$pollJob({
jobId,
action: {
isFetchData: false
},
successMethod: () => {
eventBus.emit('update-resource-state', { selectedItems: this.selectedItems, resource: keypair.id, state: 'success' })
},
catchMethod: () => {
eventBus.emit('update-resource-state', { selectedItems: this.selectedItems, resource: keypair.id, state: 'failed' })
}
})
} catch (e) {
eventBus.emit('update-resource-state', { selectedItems: this.selectedItems, resource: keypair.id, state: 'failed' })
} finally {
this.fetchLoading = false
}
})
Comment on lines +289 to +313
deleteKeypairs (keypairs) {
this.fetchLoading = true
keypairs.forEach(async keypair => {
try {
const jobId = await this.deleteKeyPair({
keypairid: keypair.id
})
await this.$pollJob({
jobId,
action: {
isFetchData: false
},
successMethod: () => {
eventBus.emit('update-resource-state', { selectedItems: this.selectedItems, resource: keypair.id, state: 'success' })
},
catchMethod: () => {
eventBus.emit('update-resource-state', { selectedItems: this.selectedItems, resource: keypair.id, state: 'failed' })
}
})
} catch (e) {
eventBus.emit('update-resource-state', { selectedItems: this.selectedItems, resource: keypair.id, state: 'failed' })
} finally {
this.fetchLoading = false
}
})

String description = detail.get(ApiConstants.DESCRIPTION);
if (StringUtils.isNotEmpty(description)) {
if (permission.length() > 255) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants